package com.Brave.manager.Demo05;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Demo06 {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        Pro p1 = new Pro();

        FutureTask<String> ft1 = new FutureTask<>(p1);

        Thread t1 = new Thread(ft1, "线程1");

        t1.setPriority(10);

        t1.start();
        String str1 = ft1.get();
        System.out.println(str1 + Thread.currentThread().getName());

        Pro p2 = new Pro();

        FutureTask<String> ft2 = new FutureTask<>(p2);

        Thread t2 = new Thread(ft2, "线程2");
        t2.setPriority(2);

        t2.start();
        String str2 = ft2.get();
        System.out.println(str2 + Thread.currentThread().getName());
    }
}
